package temp;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @version 1.0, 05.07.2008
 * @author Holger Wiehen
 */
public class AttributeTypeResolver {
    
    private String thisTypeName;
    private Map<String, String> attributeToTypeMapping;
    
    public AttributeTypeResolver( String thisQualifiedTypeName ){
        thisTypeName = thisQualifiedTypeName;
        attributeToTypeMapping = new HashMap<String, String>();
    }
    
    public void addAttribute( String shortAttributeName, String type ){
        attributeToTypeMapping.put( thisTypeName + "." + shortAttributeName, type);
    }
    
    public String getAttributeType(String shortAttributeName){
        return attributeToTypeMapping.get( thisTypeName + "." + shortAttributeName);
    }
    
    public void test(){
        Set<String> attributos = attributeToTypeMapping.keySet();
        String typeName;
        System.out.println("\nAttributos definidos para o tipo " + thisTypeName );
        for( String attName : attributos ){
            typeName = attributeToTypeMapping.get(attName);
            System.out.println(attName + "\t" + typeName);
        }
    }

}
